package main

import "fmt"

type Student struct {
	name    string
	age     int
	courses []string
}

func initStudent(s *Student) {
	s.name = "xxx"                          // 与(*s).name = "xxx"等价
	s.age = 21                              // 与(*s).age = 21等价
	s.courses = []string{"chinese", "math"} // 与(*s).courses等价
}

func main() {
	// 初始化方式3：使用&结构体赋值
	var stu Student
	initStudent(&stu)
	fmt.Println(stu)
}
